﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Truron.Purchase.Utility
{
    public class StaticConstraint
    {
        /// <summary>
        /// 以前直接读配置文件
        /// ConnectionStrings:JDDbConnectionString
        /// </summary>
        public static string JDDbConnection = null;
        ///// <summary>
        ///// 缓存过期时间(天)
        ///// </summary>
        //public static int cacheExpireDay = 7;
        /// <summary>
        /// 系统默认密码
        /// </summary>
        public static string TruronPassword = "truron123";
        /// <summary>
        /// 委外单key
        /// </summary>
        public static string PurchaseOuterNoteCacheKey = "PurchaseOuterNote";
        /// <summary>
        /// 区域key
        /// </summary>
        public static string PurchaseAreaCacheKey = "PurchaseArea";
        /// <summary>
        /// 分类key
        /// </summary>
        public static string PurchaseCategoryCacheKey = "PurchaseCategory";
        /// <summary>
        /// 供应商key
        /// </summary>
        public static string PurchaseSupplyCacheKey = "PurchaseSupply";
        /// <summary>
        /// 委外需求key
        /// </summary>
        public static string PurchaseOuterRequestCacheKey = "PurchaseOuterRequest";
        /// <summary>
        /// 委外明细key
        /// </summary>
        public static string PurchaseOuterRequestDetailCacheKey = "PurchaseOuterRequestDetail";
        /// <summary>
        /// 委外需求审批key
        /// </summary>
        public static string PurchaseOuterRequestApproveCacheKey = "PurchaseOuterRequestApprove";
        /// <summary>
        /// 委外和需求单的关系
        /// </summary>
        public static string PurchaseOuterRequestNoteRelationCacheKey = "PurchaseOuterRequestNoteRelation";
        /// <summary>
        /// 委外单审批key
        /// </summary>
        public static string PurchaseOuterNoteApprovalCacheKey = "PurchaseOuterNoteApproval";
        /// <summary>
        /// 文件key
        /// </summary>
        public static string PurchaseFileInfoCacheKey = "PurchaseFileInfo";
        /// <summary>
        /// 左侧树分组的key
        /// </summary>
        public static string PurchaseLeftGroupKey = "PurchaseLeftGroup";
        public static string Purchase_TestCacheKey = "Purchase_Test";
        public static string Purchase_OuterRequestDetailApprovalCacheKey = "Purchase_OuterRequestDetailApproval";
        public static string Purchase_OuterNoteDetailCacheKey = "Purchase_OuterNoteDetail";
        public static string Purchase_DataSourceCacheKey = "Purchase_DataSource";
        public static string Purchase_OuterNotePayRelationCacheKey = "Purchase_OuterNotePayRelation";
        public static string Purchase_OuterNoteInvoiceRelationCacheKey = "Purchase_OuterNoteInvoiceRelation";
        public static void Init(Func<string, string> func)
        {
            JDDbConnection = func.Invoke("AppSettings:ConnectionString");
            //循环--反射的方式初始化多个
        }
    }
    public static class ErrorCodeConst
    {
        #region 系统级别错误  通用
        /// <summary>
        /// token验证失败
        /// </summary>
        public static int TokenError = 900;
        /// <summary>
        /// 服务调用失败
        /// </summary>
        public static int ServiceError = 990;
        /// <summary>
        /// 参数解析失败
        /// </summary>
        public static int ParameterError = 998;
        #endregion
        /// <summary>
        /// 关联的委外任务数量超过委外单的数量
        /// </summary>
        public static int OuterNoteRelationNumError = 2001;
        /// <summary>
        /// 线索状态必须为完成状态,才能归档
        /// </summary>
        public static int ClueStatusError = 2002;
        /// <summary>
        /// 关联客户不在自己名下,请联系所属人共享
        /// </summary>
        public static int CustomerOmnerError = 2003;
        /// <summary>
        /// 没有权限查看该数据
        /// </summary>
        public static int IsNotPowerError = 2004;
        /// <summary>
        /// 非框架合同必须关联报价单才能赢得
        /// </summary>
        public static int NonFrameRelationError = 2005;
        /// <summary>
        /// 上级负责人为空，请先维护组织部门
        /// </summary>
        public static int NotManagerError = 2006;
        /// <summary>
        /// 报价单未审批完成,无法赢得
        /// </summary>
        public static int ApproverGainError = 2007;
        /// <summary>
        /// 报价单审批被拒绝,无法赢得
        /// </summary>
        public static int ApproverGainFailError = 2008;

        /// <summary>
        /// 联系人已关联客户信息，无法删除
        /// </summary>
        public static int DelContactsError = 2000;
        /// <summary>
        /// 客户已关联商机信息,无法删除
        /// </summary>
        public static int DelCustomerError = 2009;
        /// <summary>
        /// 线索已归档,无法删除
        /// </summary>
        public static int DelClueError = 2010;
        /// <summary>
        /// 商机已关联报价单,无法删除
        /// </summary>
        public static int DelBusinessError = 2011;
        /// <summary>
        /// 报价单已赢得,无法删除
        /// </summary>
        public static int DelQuotationError = 2012;
        /// <summary>
        /// 报价单已变更,请重新刷新
        /// </summary>
        public static int QuotationChangeError = 2013;

        /// <summary>
        /// 报价单信息不完整,无法赢得
        /// </summary>
        public static int ApproverGainDefectError = 2014;
        /// <summary>
        /// 关联产品信息不存在
        /// </summary>
        public static int CrmProductNotExistError = 2015;
    }
}
